//
//  renWuView.m
//  OfferJob
//
//  Created by 河南动力无限科技有限公司 on 17/7/13.
//  Copyright © 2017年 郑州动力无限科技. All rights reserved.
//

#import "renWuView.h"

@interface renWuView ()

@property(nonatomic,strong)NSArray *dataArr;
@property(nonatomic,strong)UIView* view;
@end



@implementation renWuView

-(id)initWithFrame:(CGRect)frame{
    self=[super initWithFrame:frame];
    if (self) {
        self.backgroundColor=[UIColor colorWithRed:0 green:0 blue:0 alpha:.4];
    
//        _view=[[UIView alloc]initWithFrame:CGRectMake(0, 120, SCREEN_WIDTH, SCREEN_HEIGHT)];
//        [self addSubview:_view];
//        [self reshData];
        NSArray* arr=[NSArray arrayWithObjects:@"张兴",@"张蓝",@"张只能",@"张快乐", nil];
        [self newView:arr];
        
    }
    return self;
}

-(void)newView:(NSArray *)arr
{
  
    
    for (int i=0; i<arr.count; i++) {
        UIButton *btn=[UIButton buttonWithType:0];
        btn.frame=CGRectMake(0, 44*kAppScale*i, SCREEN_WIDTH, 44*kAppScale);
        [btn setFont:[UIFont systemFontOfSize:13*kAppScale]];
        [btn setTitleColor:[UIColor blackColor] forState:0];
        btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        btn.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
        btn.tag=i+1;
        
        [btn setTitle:arr[i][@"name"] forState:0];
        [btn addTarget:self action:@selector(seleZongJia:) forControlEvents:1<<6];
        
//        if (i==0) {
//            [btn addSubview:[self getView:CGRectMake(0, 0, SCREEN_WIDTH, .5)]];
//        }
//        else
//        {
//            [btn addSubview:[self getView:CGRectMake(10*kAppScale, 0, SCREEN_WIDTH-20*kAppScale, .5)]];
//        }
//        if (i==arr.count-1) {
//            
//            _mainSC.contentSize=CGSizeMake(0, btn.bottom);
//        }
        [self addSubview:btn];
    }
    
}
-(void)seleZongJia:(UIButton *)btn
{
    
    if (_huXingBlock) {
        _huXingBlock(_dataArr[btn.tag-1]);
    }
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
